#include "MainWindowBase.h"
#include "PanelBase.h"
#include <QContextMenuEvent>
OCEANUI::CPanelBase::CPanelBase(const QString& panelName,QWidget* parent):
	QWidget(parent)
{
	//OCEANUI::CMainWindowBase::gInstance().hookEvent(NULL);

	dock_ = new QDockWidget(panelName,parent,0);
	QString colorName("White");
	setObjectName(colorName + QLatin1String(" Dock Widget"));
	dock_->setWindowTitle(objectName() + QLatin1String(" [*]"));

	
}

//void OCEANUI::CPanelBase::contextMenuEvent( QContextMenuEvent *event )
//{
//	event->accept();
//	menu->exec(event->globalPos());
//}

//void OCEANUI::CPanelBase::resizeEvent( QResizeEvent *e )
//{
//	if (BlueTitleBar *btb = qobject_cast<BlueTitleBar*>(titleBarWidget()))
//		btb->updateMask();
//
//	QDockWidget::resizeEvent(e);
//}

//void OCEANUI::CPanelBase::setCustomSizeHint( const QSize &size )
//{
//	if (ColorDock *dock = qobject_cast<ColorDock*>(widget()))
//		dock->setCustomSizeHint(size);
//}
//
//void OCEANUI::CPanelBase::allow( Qt::DockWidgetArea area, bool a )
//{
//	Qt::DockWidgetAreas areas = allowedAreas();
//	areas = a ? areas | area : areas & ~area;
//	setAllowedAreas(areas);
//
//	if (areaActions->isEnabled()) {
//		leftAction->setEnabled(areas & Qt::LeftDockWidgetArea);
//		rightAction->setEnabled(areas & Qt::RightDockWidgetArea);
//		topAction->setEnabled(areas & Qt::TopDockWidgetArea);
//		bottomAction->setEnabled(areas & Qt::BottomDockWidgetArea);
//	}
//}
//
//void OCEANUI::CPanelBase::place( Qt::DockWidgetArea area, bool p )
//{
//	if (!p) return;
//
//	QMainWindow *mainWindow = qobject_cast<QMainWindow *>(parentWidget());
//	mainWindow->addDockWidget(area, this);
//
//	if (allowedAreasActions->isEnabled()) {
//		allowLeftAction->setEnabled(area != Qt::LeftDockWidgetArea);
//		allowRightAction->setEnabled(area != Qt::RightDockWidgetArea);
//		allowTopAction->setEnabled(area != Qt::TopDockWidgetArea);
//		allowBottomAction->setEnabled(area != Qt::BottomDockWidgetArea);
//	}
//}